package com.uwaterloo.jobmineplus.data;

import java.util.Date;
import java.util.Set;

public final class Interview {
	private String company;
	private String position;
	private InterviewType type;
	private Location location;
	private Date date;
	private Set<Interviewer> interviewers;
	
	public Interview(String company, String position, InterviewType type, Location location, Set<Interviewer> interviewer) {
		this.company = company;
		this.position = position;
		this.type = type;
		this.location = location;
		this.interviewers = interviewer;
	}
	
	public String getCompany() {
		return company;
	}
	
	public String getposition() {
		return position;
	}

	public InterviewType getType() {
		return type;
	}

	public Location getLocation() {
		return location;
	}
	
	public Set<Interviewer> getInterviewers() {
		return interviewers;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	public Date getDate() {
		return date;
	}
	
	public void addInterviewer(Interviewer interviewer) {
		interviewers.add(interviewer);
	}
	
	public void removeInterviewer(Interviewer targetInterviewer) {
		interviewers.remove(targetInterviewer);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((company == null) ? 0 : company.hashCode());
		result = prime * result + ((date == null) ? 0 : date.hashCode());
		result = prime * result
				+ ((interviewers == null) ? 0 : interviewers.hashCode());
		result = prime * result
				+ ((location == null) ? 0 : location.hashCode());
		result = prime * result
				+ ((position == null) ? 0 : position.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Interview other = (Interview) obj;
		if (company == null) {
			if (other.company != null)
				return false;
		} else if (!company.equals(other.company))
			return false;
		if (date == null) {
			if (other.date != null)
				return false;
		} else if (!date.equals(other.date))
			return false;
		if (interviewers == null) {
			if (other.interviewers != null)
				return false;
		} else if (!interviewers.equals(other.interviewers))
			return false;
		if (location == null) {
			if (other.location != null)
				return false;
		} else if (!location.equals(other.location))
			return false;
		if (position == null) {
			if (other.position != null)
				return false;
		} else if (!position.equals(other.position))
			return false;
		if (type != other.type)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Interview [company=" + company + ", position=" + position
				+ ", type=" + type + ", location=" + location + ", date="
				+ date + ", interviewers=" + interviewers + "]";
	}
}
